<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <body>

        This text above will not be displayed.

        <ui:composition template="/templateLogado.xhtml">

            This text will not be displayed.

            <ui:define name="title">
                index
            </ui:define>

            <ui:define name="content">

                <h3>
                    <h:form>
                        <h:outputText value="Aluno:"/>
                        <br/>
                        <br/>
                        <h:panelGrid columns="2">
                            <h:outputText value="Id: "/>
                            <h:outputText value="#{alunoMB.alunoCorrente.id}" />

                            <h:outputText value="Nome: "/>
                            <h:outputText value="#{alunoMB.alunoCorrente.nome}" />

                            <h:outputText value="CPF: "/>
                            <h:outputText value="#{alunoMB.alunoCorrente.cpf}"/>
                            
                            <h:outputText value="Matrícula: "/>
                            <h:outputText value="#{alunoMB.alunoCorrente.matricula}"/>
                        </h:panelGrid>

                        <br/>
                        <h:outputText value="Turmas:" />
                        <br/>
                        <br/>
                        <h:outputText value="O aluno ainda não está inscrito em nenhuma turma." 
                                      rendered="#{alunoMB.listaDataModel.getRowCount() == 0}"/>
                        <br/>

                        <h:dataTable value="#{alunoMB.listaDataModel}" 
                                     rendered="#{alunoMB.listaDataModel.getRowCount() > 0}"
                                     var="alunoTurma" border="1" bgcolor="gray" >

                            <h:column>
                                <f:facet name="header">
                                    <h:outputLabel value="Id"/>
                                </f:facet>
                                <h:outputText value="#{alunoTurma.id}"/>
                            </h:column>

                            <h:column>
                                <f:facet name="header">
                                    <h:outputLabel value="Nome"/>
                                </f:facet>
                                <h:outputText value="#{alunoTurma.turma.disciplina.nome}"/>
                            </h:column>

                            <h:column>
                                <f:facet name="header">
                                    <h:outputLabel value="Semestre"/>
                                </f:facet>
                                <h:outputText value="#{alunoTurma.turma.semestre}"/>
                            </h:column>

                            <h:column>
                                <f:facet name="header">
                                    <h:outputLabel value="Ano"/>
                                </f:facet>
                                <h:outputText value="#{alunoTurma.turma.ano}"/>
                            </h:column>
                            
                            <h:column>
                                <f:facet name="header">
                                    <h:outputLabel value="Nome do Professor"/>
                                </f:facet>
                                <h:outputText value="#{alunoTurma.turma.nomeProfessor}"/>
                            </h:column>

                            <h:column>
                                <h:commandButton value="Excluir" action="#{alunoTurmaMB.excluirPorAluno}"/>
                            </h:column>

                        </h:dataTable>

                        <br/>
                        <h:commandButton value="Voltar" action="#{alunoMB.exibirTodos}" immediate="true"/>

                    </h:form>
                </h3>

            </ui:define>

            This text will not be displayed.

        </ui:composition>

        This text below will also not be displayed.

    </body>
</html>

